package questionsObjects;

public class UniversalQuestion implements Question {
    private final String question;
    private final String correctAnswer;
    private final String answers;
    private final FeaturesOfQuestion featuresOfQuestion;

    public UniversalQuestion(String question, String correctAnswer,
                             String answers, FeaturesOfQuestion featuresOfQuestion) {
        this.question = question;
        this.correctAnswer = correctAnswer.trim();
        this.answers = answers.trim();
        this.featuresOfQuestion = featuresOfQuestion;
    }

    public String getQuestion() {
        return question;
    }

    public String getCorrectAnswer() {
        return correctAnswer;
    }

    public String getAnswers() {
        return answers;
    }

    public String getTheme() {
        return featuresOfQuestion.getTheme();
    }

    public int getComplexity() {
        return featuresOfQuestion.getComplexity();
    }

    public boolean isCorrectAnswer(String answer) {
        String currentAnswer;
        currentAnswer = answer.trim().toUpperCase();
        return correctAnswer.toUpperCase().indexOf(currentAnswer) == -1 ? false : true;
    }
}
